#ifndef MYCUNIT_H
#define MYCUNIT_H

#include <QObject>
#include "public_global.h"
#include "Factory.h"

// 通信地址:
struct COMADDRESS
{
    bool            bValidSrc;					// 标志是否源地址
    bool            bValidDest;                 // 标志是否目的地址
    unsigned long   dwAddressSrc;
    unsigned long   dwAddressDest;
    unsigned long   dwMinAddressSrc;
    unsigned long   dwMaxAddressSrc;
    unsigned long   dwMinAddressDest;
    unsigned long   dwMaxAddressDest;
};

class myCPort;

// 通信控制块:
struct COMCONTROL
{
    myCPort*            pPort;                  // 通信口;
    unsigned char*		pTXBuf;                 // 通信发送缓冲区;
    unsigned char*		pRXBuf;                 // 通信接收缓冲区;
};

#define pCCPort		pCC->pPort
#define pCCTX		pCC->pTXBuf
#define pCCRX		pCC->pRXBuf


//---------------------------------------------- myCUnit ---------------------
class myCUnit : public QObject
{
    Q_OBJECT
public:
    explicit myCUnit(QObject *parent = 0);
protected:
    virtual ~myCUnit();
public:
    string			m_strType;			// 该单元类型;
    string			m_strName;			// 该单元名称(唯一性);
    bool			m_bUsed;			// 是否投入使用标志;
    COMADDRESS		m_address;			// 通信地址;
    vector<myCFactory*>	m_factorys;			// 数据工厂集合;


signals:

public slots:
};

#endif // MYCUNIT_H
